.class public Lrexsee/ebook/TextLine;
.super Ljava/lang/Object;
.source "TextLine.java"

# interfaces
.implements Lrexsee/ebook/LineInterface;


# instance fields
.field indexTitle:Ljava/lang/String;

.field private final mLineHeight:I

.field private final mPaint:Landroid/graphics/Paint;

.field private final mText:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;ILandroid/graphics/Paint;)V
    .locals 1
    .param p1, "text"    # Ljava/lang/String;
    .param p2, "lineHeight"    # I
    .param p3, "paint"    # Landroid/graphics/Paint;

    .prologue
    .line 13
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 9
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/ebook/TextLine;->indexTitle:Ljava/lang/String;

    .line 14
    iput-object p1, p0, Lrexsee/ebook/TextLine;->mText:Ljava/lang/String;

    .line 15
    iput p2, p0, Lrexsee/ebook/TextLine;->mLineHeight:I

    .line 16
    iput-object p3, p0, Lrexsee/ebook/TextLine;->mPaint:Landroid/graphics/Paint;

    .line 17
    return-void
.end method

.method public static getOriginX(Landroid/graphics/Rect;Landroid/graphics/Paint;)I
    .locals 3
    .param p0, "rect"    # Landroid/graphics/Rect;
    .param p1, "paint"    # Landroid/graphics/Paint;

    .prologue
    .line 36
    invoke-virtual {p1}, Landroid/graphics/Paint;->getTextAlign()Landroid/graphics/Paint$Align;

    move-result-object v0

    .line 37
    .local v0, "align":Landroid/graphics/Paint$Align;
    sget-object v1, Landroid/graphics/Paint$Align;->CENTER:Landroid/graphics/Paint$Align;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint$Align;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 38
    iget v1, p0, Landroid/graphics/Rect;->left:I

    invoke-virtual {p0}, Landroid/graphics/Rect;->width()I

    move-result v2

    div-int/lit8 v2, v2, 0x2

    add-int/2addr v1, v2

    .line 42
    :goto_0
    return v1

    .line 39
    :cond_0
    sget-object v1, Landroid/graphics/Paint$Align;->RIGHT:Landroid/graphics/Paint$Align;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint$Align;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 40
    iget v1, p0, Landroid/graphics/Rect;->right:I

    goto :goto_0

    .line 42
    :cond_1
    iget v1, p0, Landroid/graphics/Rect;->left:I

    goto :goto_0
.end method

.method public static getOriginY(Landroid/graphics/Rect;Landroid/graphics/Paint;)I
    .locals 3
    .param p0, "rect"    # Landroid/graphics/Rect;
    .param p1, "paint"    # Landroid/graphics/Paint;

    .prologue
    .line 46
    iget v0, p0, Landroid/graphics/Rect;->bottom:I

    invoke-virtual {p0}, Landroid/graphics/Rect;->height()I

    move-result v1

    int-to-float v1, v1

    invoke-virtual {p1}, Landroid/graphics/Paint;->getTextSize()F

    move-result v2

    sub-float/2addr v1, v2

    const/high16 v2, 0x40000000    # 2.0f

    div-float/2addr v1, v2

    invoke-static {v1}, Ljava/lang/Math;->round(F)I

    move-result v1

    sub-int/2addr v0, v1

    return v0
.end method


# virtual methods
.method public draw(Landroid/graphics/Canvas;Landroid/graphics/Rect;)V
    .locals 7
    .param p1, "canvas"    # Landroid/graphics/Canvas;
    .param p2, "rect"    # Landroid/graphics/Rect;

    .prologue
    .line 32
    invoke-virtual {p0}, Lrexsee/ebook/TextLine;->isNull()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 34
    :goto_0
    return-void

    .line 33
    :cond_0
    iget-object v1, p0, Lrexsee/ebook/TextLine;->mText:Ljava/lang/String;

    const/4 v2, 0x0

    iget-object v0, p0, Lrexsee/ebook/TextLine;->mText:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v3

    iget-object v0, p0, Lrexsee/ebook/TextLine;->mPaint:Landroid/graphics/Paint;

    invoke-static {p2, v0}, Lrexsee/ebook/TextLine;->getOriginX(Landroid/graphics/Rect;Landroid/graphics/Paint;)I

    move-result v0

    int-to-float v4, v0

    iget-object v0, p0, Lrexsee/ebook/TextLine;->mPaint:Landroid/graphics/Paint;

    invoke-static {p2, v0}, Lrexsee/ebook/TextLine;->getOriginY(Landroid/graphics/Rect;Landroid/graphics/Paint;)I

    move-result v0

    int-to-float v5, v0

    iget-object v6, p0, Lrexsee/ebook/TextLine;->mPaint:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v6}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;IIFFLandroid/graphics/Paint;)V

    goto :goto_0
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 28
    iget v0, p0, Lrexsee/ebook/TextLine;->mLineHeight:I

    return v0
.end method

.method public getIndexTitle()Ljava/lang/String;
    .locals 1

    .prologue
    .line 50
    iget-object v0, p0, Lrexsee/ebook/TextLine;->indexTitle:Ljava/lang/String;

    return-object v0
.end method

.method public getText()Ljava/lang/String;
    .locals 1

    .prologue
    .line 54
    iget-object v0, p0, Lrexsee/ebook/TextLine;->mText:Ljava/lang/String;

    return-object v0
.end method

.method public isNull()Z
    .locals 1

    .prologue
    .line 20
    iget-object v0, p0, Lrexsee/ebook/TextLine;->mText:Ljava/lang/String;

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isPageBreak()Z
    .locals 1

    .prologue
    .line 24
    const/4 v0, 0x0

    return v0
.end method
